package com.example.goodpet.bean;

import android.os.Parcel;
import android.os.Parcelable;

import com.google.gson.annotations.SerializedName;

public class ChannelInfoDTO implements Parcelable {
        @SerializedName("channel_name")
        private String channelName;
        @SerializedName("image")
        private String image;
        @SerializedName("id")
        private Integer id;

        protected ChannelInfoDTO(Parcel in) {
                channelName = in.readString();
                image = in.readString();
                if (in.readByte() == 0) {
                        id = null;
                } else {
                        id = in.readInt();
                }
        }

        public static final Creator<ChannelInfoDTO> CREATOR = new Creator<ChannelInfoDTO>() {
                @Override
                public ChannelInfoDTO createFromParcel(Parcel in) {
                        return new ChannelInfoDTO(in);
                }

                @Override
                public ChannelInfoDTO[] newArray(int size) {
                        return new ChannelInfoDTO[size];
                }
        };

        public String getChannelName() {
                return channelName;
        }

        public void setChannelName(String channelName) {
                this.channelName = channelName;
        }

        public String getImage() {
                return image;
        }

        public void setImage(String image) {
                this.image = image;
        }

        public Integer getId() {
                return id;
        }

        public void setId(Integer id) {
                this.id = id;
        }

        @Override
        public String toString() {
                return "ChannelInfoDTO{" +
                        "channelName='" + channelName + '\'' +
                        ", image='" + image + '\'' +
                        ", id=" + id +
                        '}';
        }

        @Override
        public int describeContents() {
                return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
                dest.writeString(channelName);
                dest.writeString(image);
                if (id == null) {
                        dest.writeByte((byte) 0);
                } else {
                        dest.writeByte((byte) 1);
                        dest.writeInt(id);
                }
        }
}
